# -*- coding: UTF-8 -*-
"""
@Time    :  2021/1/14
@Author  :  Ricky
@Contact :  382688672@qq.com
@File    :  main.py
@Desc    :  None
"""
import os
import sys

from SeleniumTestRunner import SeleniumTestRunner

args: list[str] = sys.argv

idx: str = 1
dirpath: str = None
skipPyTest: bool = False
genAllureReport: bool = False
while idx < len(args):
    arg: str = args[idx]
    idx += 1
    if arg.lower() == '-g':
        genAllureReport = True
    elif arg.lower() == '-s':
        skipPyTest = True
    elif not arg.startswith('-'):
        tmppath = os.path.abspath(os.path.join(os.path.dirname(__file__), arg))
        if not dirpath and os.path.isdir(tmppath):
            dirpath = tmppath

if not dirpath:
    exit('异常退出：缺乏启动参数 <目录路径>')
else:
    SeleniumTestRunner.loadAll(os.path.join(os.path.dirname(__file__), dirpath), skipPyTest, genAllureReport)
